Writes data to a sequential file.
順編成ファイルに対してデータを書き込みます。
Write [#FileName], [Expressionlist]
Write [#FileName], [Expressionlist]
FileName: Any numeric expression that contains the file number that was set by the Open statement for the respective file.
FileName: 該当ファイルに対し Open ステートメントが割り当てたファイル番号を示す数値表式。
Expressionlist: Variables or expressions that you want to enter in a file, separated by commas.
Expressionlist: ファイルに書き込むコンマ区切りのデータを示す、変数または表式。
If the expression list is omitted, the Write statement appends an empty line to the file.
式リストを省略すると、Write 文が空の行をファイルに追加します。
To add an expression list to a new or an existing file, the file must be opened in the Output or Append mode.
新規のファイルにせよ既存のファイルにせよ、データを書き込む場合は、該当ファイルを Output またはAppend モードでオープンしておく必要があります。
Strings that you write are enclosed by quotation marks and separated by commas. You do not need to enter these delimiters in the expression list.
記述した文字列は引用符で囲まれ、コンマで区切られます。 式リストにこれらの区切り記号を入力する必要はありません。
Each Write statement outputs a line end symbol as last entry.
各 Write ステートメントは、行と記号を最後の項目として出力します。
Numbers with decimal delimiters are converted according to the locale settings.
小数点のある数値は、ロケール設定に従って変換されます。
Sub ExampleWrite
Sub ExampleWrite
Dim iCount As Integer
Dim iCount As Integer
Dim sValue As String
Dim sValue As String
iCount = Freefile
iCount = Freefile
open "C:\data.txt" for OutPut as iCount
open "C:\data.txt" for OutPut as iCount
sValue = "Hamburg"
SValue = "Hamburg"
Write #iCount,sValue,200
Write #iCount,sValue,200
sValue = "New York"
SValue = "New York"
Write #iCount,sValue,300
Write #iCount,sValue,300
sValue = "Miami"
SValue = "Miami"
Write #iCount,sValue,450
Write #iCount,sValue,450
close #iCount
close #iCount
end sub
end sub